﻿using Mvc.Mailer;
using EC_ASS.Controllers;
using EC_ASS.Models;
using System.Collections.Generic;
using System.Web;
using System.Web.Mvc;

namespace EC_ASS.Mailers
{ 
    public class UserMailer : MailerBase, IUserMailer 	
	{
		public UserMailer()
		{
			MasterName="_Layout";
		}
		
		public virtual MvcMailMessage Welcome(string email, string customer)
		{
			//ViewBag.Data = someObject;
            ViewBag.Name = customer;
			return Populate(x =>
			{
                x.Subject = "MShop - Chào mừng [" + customer + "]";
				x.ViewName = "Welcome";
                x.To.Add(email);
			});
		}

        public virtual MvcMailMessage PasswordReset(string email, string customer, string password)
        {
            ViewBag.Name = customer;
            ViewBag.Password = password;
            return Populate(x =>
            {
                x.Subject = "MShop - Mật khẩu mới của tài khoản [" + customer + "]";
                x.ViewName = "PasswordReset";
                x.To.Add(email);
            });
        }

        public virtual MvcMailMessage OrderInfo(Customer customer, Order order)
        {
            ViewBag.Cus = customer;
            ViewBag.Info = order;
            return Populate(x =>
            {
                x.Subject = "MShop - Thông báo đặt hàng thành công đến [" + customer.Name + "]";
                x.ViewName = "OrderInfo";
                x.To.Add(customer.Email);
            });
        }
 	}
}